//
//  HMStatusCell.swift
//  sina
//
//  Created by Kent on 16/9/27.
//  Copyright © 2016年 Ming. All rights reserved.
//

import UIKit

private let margin = CGFloat(8)

//图片之间的间距
let pictureCellMargin: CGFloat = 3

//计算图片的宽度
let maxWidth = ScreenWidth - 2 * margin
let itemWidth = (maxWidth - 2 * pictureCellMargin) / 3

class HMStatusCell: UITableViewCell {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    var viewModel: HMStatusViewModel? {
        didSet {
            
            statusOriView.viewModel = viewModel
            statusForwardView.viewModel = viewModel

        }
    }

    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: .default, reuseIdentifier: reuseIdentifier)
        selectionStyle = .none
        newContent()
    }
    

    
    func newContent() {
        
        contentView.addSubview(statusOriView)
        
        statusOriView.snp.makeConstraints { (make) in
            make.left.top.right.equalTo(contentView)
        }
        
        contentView.addSubview(statusForwardView)
        
        statusForwardView.snp.makeConstraints { (make) in
            make.left.equalTo(contentView).offset(margin)
            make.right.equalTo(contentView).offset(-margin)
            make.top.equalTo(statusOriView.snp.bottom).offset(margin)
        }
        
        contentView.addSubview(statusToolView)
        
        statusToolView.snp.makeConstraints { (make) in
            make.top.equalTo(statusForwardView.snp.bottom).offset(margin)
            make.left.right.bottom.equalTo(contentView)
        }
    
    }
    
    lazy var statusOriView: HMStatusOriView = HMStatusOriView()
    
    lazy var statusForwardView: HMStatusForwardView = HMStatusForwardView()
    
    lazy var statusToolView: HMStatusToolView = HMStatusToolView()
    

    
}












































